#! python3
# multi-clipboard.py - saves and loads pieces of text to the clipboard.
# usage: py.exe multi-clipboard.py save <keyword> - Saves clipboard to keyword.
#        py.exe multi-clipboard.py <keyword> - Loads keyword to clipboard.
#        py.exe multi-clipboard.py list -Loads all keywords to clipboard
import shelve,pyperclip,sys
mcbShelf=shelve.open('mcb')
if len(sys.argv)==3 and sys.argv[1].lower()=='save':
    mcbShelf[sys.argv[2]]=pyperclip.paste()
elif len(sys.argv)==2:
    # list keywords and load content
    if sys.argv[1].lower()=='list':
        print(str(list(mcbShelf.keys())))
        #pyperclip.copy(str(list(mcbShelf.keys())))
    elif sys.argv[1] in mcbShelf:
        pyperclip.copy(mcbShelf[sys.argv[1]])
mcbShelf.close()                                                                                